package Marco::DataObject;
use strict;
use base 'Marco::Object';

__PACKAGE__->mk_accessors( qw( db ) );

# only accept Marco::Database derived objects
sub db {
    my($self) = shift;
    my($db) = @_;

    if( @_ ) {  # Setting
        unless($db->isa("Marco::Database")) {
        	$self->logger->error("$db is not derived from Marco::Database");
        	return;
        }
        
    }

    return $self->SUPER::db(@_);
}
sub DESTROY {
	my $self=shift;
	
	$self->SUPER::DESTROY if $self->can("SUPER::DESTROY");
	delete $self->{db};
	undef $self;
		
}

1; 